home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / ops5c.zip / TOURNEY.OPS < prev    next >
Text File  |  1988-06-02  |  12KB  |  313 lines

  1. ;11-Jan-88 12-29-03-EST,11896;000000000001
  2. ;Return-Path- <Milind.Tambe@b.gp.cs.cmu.edu>
  3. ;Received- from B.GP.CS.CMU.EDU by CS.COLUMBIA.EDU with TCP; Mon 11 Jan 88 12-28-50-EST
  4. ;Date- Mon, 11 Jan 88 12-24-05 EST
  5. ;From- Milind.Tambe@B.GP.CS.CMU.EDU
  6. ;To- sal@CS.COLUMBIA.EDU
  7. ;Subject- The Tourney program
  8. ;
  9. ;Here is second OPS5 program
  10.  
  11. (literalize player
  12.   number
  13.   nights-scheduled)
  14.  
  15. (literalize foursome
  16.   night
  17.   group
  18.   north
  19.   south
  20.   east
  21.   west)
  22.  
  23. (literalize context
  24.   name)
  25.  
  26. (literalize scheduling
  27.   night)
  28.  
  29. (literalize already-played
  30.   player1
  31.   player2)
  32.  
  33. (literalize candidate
  34.   group
  35.   chosen
  36.   south
  37.   east
  38.   west)
  39. (literalize start
  40.    state
  41.    )
  42.  
  43.  
  44. (p startup 
  45.   (start ^state 1)
  46. -->
  47.   (make player ^number 1 ^nights-scheduled 0)
  48.   (make player ^number 2 ^nights-scheduled 0)
  49.   (make player ^number 3 ^nights-scheduled 0)
  50.   (make player ^number 4 ^nights-scheduled 0)
  51.   (make player ^number 5 ^nights-scheduled 0)
  52.   (make player ^number 6 ^nights-scheduled 0)
  53.   (make player ^number 7 ^nights-scheduled 0)
  54.   (make player ^number 8 ^nights-scheduled 0)
  55.   (make player ^number 9 ^nights-scheduled 0)
  56.   (make player ^number 10 ^nights-scheduled 0)
  57.   (make player ^number 11 ^nights-scheduled 0)
  58.   (make player ^number 12 ^nights-scheduled 0)
  59.   (make player ^number 13 ^nights-scheduled 0)
  60.   (make player ^number 14 ^nights-scheduled 0)
  61.   (make player ^number 15 ^nights-scheduled 0)
  62.   (make player ^number 16 ^nights-scheduled 0)
  63.   (make foursome ^night 1 ^group a ^north nil ^south nil ^east nil ^west nil)
  64.   (make foursome ^night 1 ^group b ^north nil ^south nil ^east nil ^west nil)
  65.   (make foursome ^night 1 ^group c ^north nil ^south nil ^east nil ^west nil)
  66.   (make foursome ^night 1 ^group d ^north nil ^south nil ^east nil ^west nil)
  67.   (make foursome ^night 2 ^group a ^north nil ^south nil ^east nil ^west nil)
  68.   (make foursome ^night 2 ^group b ^north nil ^south nil ^east nil ^west nil)
  69.   (make foursome ^night 2 ^group c ^north nil ^south nil ^east nil ^west nil)
  70.   (make foursome ^night 2 ^group d ^north nil ^south nil ^east nil ^west nil)
  71.   (make foursome ^night 3 ^group a ^north nil ^south nil ^east nil ^west nil)
  72.   (make foursome ^night 3 ^group b ^north nil ^south nil ^east nil ^west nil)
  73.   (make foursome ^night 3 ^group c ^north nil ^south nil ^east nil ^west nil)
  74.   (make foursome ^night 3 ^group d ^north nil ^south nil ^east nil ^west nil)
  75.   (make foursome ^night 4 ^group a ^north nil ^south nil ^east nil ^west nil)
  76.   (make foursome ^night 4 ^group b ^north nil ^south nil ^east nil ^west nil)
  77.   (make foursome ^night 4 ^group c ^north nil ^south nil ^east nil ^west nil)
  78.   (make foursome ^night 4 ^group d ^north nil ^south nil ^east nil ^west nil)
  79.   (make foursome ^night 5 ^group a ^north nil ^south nil ^east nil ^west nil)
  80.   (make foursome ^night 5 ^group b ^north nil ^south nil ^east nil ^west nil)
  81.   (make foursome ^night 5 ^group c ^north nil ^south nil ^east nil ^west nil)
  82.   (make foursome ^night 5 ^group d ^north nil ^south nil ^east nil ^west nil)
  83.   (make context ^name north)
  84.   (make scheduling ^night 1)
  85.   (write (tabto 32) |Tournament Schedule| (crlf) (crlf)
  86.      (tabto 15) |N  S  E  W|
  87.      (tabto 42) |N  S  E  W|
  88.      (tabto 68) |N  S  E  W| (crlf)
  89.      (tabto 15) |=  =  =  =|
  90.      (tabto 42) |=  =  =  =|
  91.      (tabto 68) |=  =  =  =| (crlf)))
  92.  
  93. (p north-pick-one-1
  94.   (context ^name north)
  95.   (scheduling ^night <n>)
  96.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  97.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  98.   (foursome ^night <n> ^north { <p1> <> nil })
  99.   (foursome ^night <n> ^north { <p2> <> <p1> <> nil })
  100.   (foursome ^night <n> ^north { <p3> <> <p2> <> <p1> <> nil })
  101.   (already-played ^player1 <p> ^player2 <p1>)
  102.   (already-played ^player1 <p> ^player2 <p2>)
  103.   (already-played ^player1 <p> ^player2 <p3>)
  104. -->
  105.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  106.   (modify <THE-FOURSOME> ^north <p>) )
  107.  
  108. (p north-pick-one-2
  109.   (context ^name north)
  110.   (scheduling ^night <n>)
  111.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  112.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  113.   (foursome ^night <n> ^north { <p1> <> nil })
  114.   (foursome ^night <n> ^north { <p2> <> <p1> <> nil })
  115.   (already-played ^player1 <p> ^player2 <p1>)
  116.   (already-played ^player1 <p> ^player2 <p2>)
  117. -->
  118.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  119.   (modify <THE-FOURSOME> ^north <p>) )
  120.  
  121. (p north-pick-one-3
  122.   (context ^name north)
  123.   (scheduling ^night <n>)
  124.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  125.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  126.   (foursome ^night <n> ^north { <p1> <> nil })
  127.   (already-played ^player1 <p> ^player2 <p1>)
  128. -->
  129.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  130.   (modify <THE-FOURSOME> ^north <p>) )
  131.  
  132. (p north-pick-one-4
  133.   (context ^name north)
  134.   (scheduling ^night <n>)
  135.   { <THE-FOURSOME> (foursome ^night <n> ^north nil) }
  136.   { <THE-PLAYER> (player ^number <p> ^nights-scheduled < <n>) }
  137. -->
  138.   (modify <THE-PLAYER> ^nights-scheduled <n>)
  139.   (modify <THE-FOURSOME> ^north <p>) )
  140.  
  141. (p north-done
  142.   { <THE-CONTEXT> (context ^name north) }
  143. -->
  144.   (modify <THE-CONTEXT> ^name make-candidates))
  145.  
  146. (p make-candidates-make-candidate
  147.   (context ^name make-candidates)
  148.   (scheduling ^night { <n> < 3 })
  149.   (foursome ^night <n> ^group <g> ^north <yankee>)
  150.   (player ^number <redneck> ^nights-scheduled < <n>)
  151.   (player ^number { <oriental> < <redneck> } ^nights-scheduled < <n>)
  152.   (player ^number { <cowboy> < <oriental> } ^nights-scheduled < <n>)
  153.   - (already-played ^player1 <yankee> ^player2 <redneck>)
  154.   - (already-played ^player1 <yankee> ^player2 <oriental>)
  155.   - (already-played ^player1 <yankee> ^player2 <cowboy>)
  156.   - (already-played ^player1 <redneck> ^player2 <oriental>)
  157.   - (already-played ^player1 <redneck> ^player2 <cowboy>)
  158.   - (already-played ^player1 <oriental> ^player2 <cowboy>)
  159.   - (candidate ^group <g> ^chosen no ^south <redneck> ^east <oriental>)
  160.   - (candidate ^group <g> ^chosen no ^south <redneck> ^west <cowboy>)
  161.   - (candidate ^group <g> ^chosen no ^east <oriental> ^west <cowboy>)
  162. -->
  163.   (make candidate ^group <g> ^chosen no
  164.      ^south <redneck> ^east <oriental> ^west <cowboy>))
  165.  
  166. (p make-candidates-make-candidate-late
  167.   (context ^name make-candidates)
  168.   (scheduling ^night { <n> > 2 })
  169.   (foursome ^night <n> ^group <g> ^north <yankee>)
  170.   (player ^number <redneck> ^nights-scheduled < <n>)
  171.   (player ^number { <oriental> < <redneck> } ^nights-scheduled < <n>)
  172.   (player ^number { <cowboy> < <oriental> } ^nights-scheduled < <n>)
  173.   - (already-played ^player1 <yankee> ^player2 <redneck>)
  174.   - (already-played ^player1 <yankee> ^player2 <oriental>)
  175.   - (already-played ^player1 <yankee> ^player2 <cowboy>)
  176.   - (already-played ^player1 <redneck> ^player2 <oriental>)
  177.   - (already-played ^player1 <redneck> ^player2 <cowboy>)
  178.   - (already-played ^player1 <oriental> ^player2 <cowboy>)
  179. -->
  180.   (make candidate ^group <g> ^chosen no
  181.     ^south <redneck> ^east <oriental> ^west <cowboy>))
  182.  
  183. (p make-candidates-done
  184.   { <THE-CONTEXT> (context ^name make-candidates) }
  185. -->
  186.   (modify <THE-CONTEXT> ^name make-choice)) 
  187.  
  188. (p make-choice-doit
  189.   { <THE-CONTEXT> (context ^name make-choice) }
  190.   { <WINNER-A> (candidate ^group a ^chosen no
  191.     ^south <sa>
  192.     ^east  <ea>
  193.     ^west  <wa>) }
  194.   { <WINNER-B> (candidate ^group b ^chosen no
  195.     ^south { <sb> <> <sa> <> <ea> <> <wa> }
  196.     ^east  { <eb> <> <sa> <> <ea> <> <wa> }
  197.     ^west  { <wb> <> <sa> <> <ea> <> <wa> }) }
  198.   { <WINNER-C> (candidate ^group c ^chosen no
  199.     ^south { <sc> <> <sa> <> <ea> <> <wa> <> <sb> <> <eb> <> <wb> }
  200.     ^east  { <ec> <> <sa> <> <ea> <> <wa> <> <sb> <> <eb> <> <wb> }
  201.     ^west  { <wc> <> <sa> <> <ea> <> <wa> <> <sb> <> <eb> <> <wb> }) }
  202.   { <WINNER-D> (candidate ^group d ^chosen no
  203.     ^south { <sd>
  204.             <> <sa> <> <ea> <> <wa>
  205.             <> <sb> <> <eb> <> <wb>
  206.             <> <sc> <> <ec> <> <wc> }
  207.     ^east  { <ed>
  208.             <> <sa> <> <ea> <> <wa>
  209.             <> <sb> <> <eb> <> <wb>
  210.             <> <sc> <> <ec> <> <wc> }
  211.     ^west  { <wd>
  212.             <> <sa> <> <ea> <> <wa>
  213.             <> <sb> <> <eb> <> <wb>
  214.             <> <sc> <> <ec> <> <wc> }) }
  215. --> 
  216.   (modify <WINNER-A> ^chosen yes)
  217.   (modify <WINNER-B> ^chosen yes)
  218.   (modify <WINNER-C> ^chosen yes)
  219.   (modify <WINNER-D> ^chosen yes)
  220.   (modify <THE-CONTEXT> ^name remove-candidates))
  221.  
  222. (p remove-candidates-bye
  223.   (context ^name remove-candidates)
  224.   { <THE-CANDIDATE> (candidate ^chosen no) }
  225. -->
  226.   (remove <THE-CANDIDATE>))
  227.  
  228. (p remove-candidates-done
  229.   { <THE-CONTEXT> (context ^name remove-candidates) }
  230. -->
  231.   (modify <THE-CONTEXT> ^name apply-choice))
  232.  
  233. (p apply-choice-doit
  234.   (context ^name apply-choice)
  235.   (scheduling ^night <n>)
  236.   { <THE-FOURSOME> (foursome ^night <n> ^group <g> ^north <yankee>) }
  237.   { <THE-CHOICE> (candidate ^group <g> ^chosen yes
  238.             ^south <redneck> ^east <oriental> ^west <cowboy>) }
  239. -->
  240.   (modify <THE-FOURSOME> ^south <redneck> ^east <oriental> ^west <cowboy>)
  241.   (remove <THE-CHOICE>)
  242.   (make already-played ^player1 <yankee> ^player2 <redneck>)
  243.   (make already-played ^player2 <yankee> ^player1 <redneck>)
  244.   (make already-played ^player1 <yankee> ^player2 <oriental>)
  245.   (make already-played ^player2 <yankee> ^player1 <oriental>)
  246.   (make already-played ^player1 <yankee> ^player2 <cowboy>)
  247.   (make already-played ^player2 <yankee> ^player1 <cowboy>)
  248.   (make already-played ^player1 <redneck> ^player2 <oriental>)
  249.   (make already-played ^player2 <redneck> ^player1 <oriental>)
  250.   (make already-played ^player1 <redneck> ^player2 <cowboy>)
  251.   (make already-played ^player2 <redneck> ^player1 <cowboy>)
  252.   (make already-played ^player1 <oriental> ^player2 <cowboy>)
  253.   (make already-played ^player2 <oriental> ^player1 <cowboy>))
  254.  
  255. (p apply-choice-done
  256.   { <THE-CONTEXT> (context ^name apply-choice) }
  257. -->
  258.   (modify <THE-CONTEXT> ^name report))
  259.  
  260. (p report-night-schedule
  261.   { <THE-CONTEXT> (context ^name report) }
  262.   (scheduling ^night <n>)
  263.   (foursome ^night <n> ^group a ^north <an> ^south <as> ^east <ae> ^west <aw>)
  264.   (foursome ^night <n> ^group b ^north <bn> ^south <bs> ^east <be> ^west <bw>)
  265.   (foursome ^night <n> ^group c ^north <cn> ^south <cs> ^east <ce> ^west <cw>)
  266.   (foursome ^night <n> ^group d ^north <dn> ^south <ds> ^east <de> ^west <dw>)
  267. -->
  268.   (modify <THE-CONTEXT> ^name next-night)
  269.   (bind <n2> (compute <n> + 5))
  270.   (bind <n3> (compute <n> + 10))
  271.   (write (crlf) (rjust 1) |#| (rjust 1) <n> (rjust 1) - (tabto 5)
  272.     |Group A-| (rjust 3) <an> (rjust 3) <as> (rjust 3) <ae> (rjust 3) <aw>
  273.     (tabto 27) (rjust 1) |#| (rjust 2) <n2> (rjust 1) - (tabto 32)
  274.     |Group A-| (rjust 3) <an> (rjust 3) <ae> (rjust 3) <as> (rjust 3) <aw>
  275.     (tabto 53) (rjust 1) |#| (rjust 2) <n3> (rjust 1)- (tabto 58)
  276.     |Group A-| (rjust 3) <an> (rjust 3) <aw> (rjust 3) <ae> (rjust 3) <as>)
  277.    (write (crlf)
  278.     (tabto 5)
  279.     |Group B-| (rjust 3) <bn> (rjust 3) <bs> (rjust 3) <be> (rjust 3) <bw>
  280.     (tabto 32)
  281.     |Group B-| (rjust 3) <bn> (rjust 3) <be> (rjust 3) <bs> (rjust 3) <bw>
  282.     (tabto 58)
  283.     |Group B-| (rjust 3) <bn> (rjust 3) <bw> (rjust 3) <be> (rjust 3) <bs>)
  284.    (write  (crlf)
  285.     (tabto 5)
  286.     |Group C-| (rjust 3) <cn> (rjust 3) <cs> (rjust 3) <ce> (rjust 3) <cw>
  287.     (tabto 32)
  288.     |Group C-| (rjust 3) <cn> (rjust 3) <ce> (rjust 3) <cs> (rjust 3) <cw>
  289.     (tabto 58)
  290.     |Group C-| (rjust 3) <cn> (rjust 3) <cw> (rjust 3) <ce> (rjust 3) <cs>)
  291.    (write (crlf)
  292.     (tabto 5)
  293.     |Group D-| (rjust 3) <dn> (rjust 3) <ds> (rjust 3) <de> (rjust 3) <dw>
  294.     (tabto 32)
  295.     |Group D-| (rjust 3) <dn> (rjust 3) <de> (rjust 3) <ds> (rjust 3) <dw>
  296.     (tabto 58)
  297.     |Group D-| (rjust 3) <dn> (rjust 3) <dw> (rjust 3) <de> (rjust 3) <ds>
  298.     (crlf)))
  299.  
  300. (p next-night-more
  301.   { <THE-CONTEXT> (context ^name next-night) }
  302.   { <THE-NIGHT> (scheduling ^night { <n> < 5 }) }
  303. -->
  304.   (modify <THE-CONTEXT> ^name north)
  305.   (modify <THE-NIGHT> ^night (compute <n> + 1)))
  306.  
  307. (p next-night-done
  308.   (context ^name next-night)
  309. -->
  310.   (write (tabto 32) |End of Scheduling| (crlf) (crlf)))
  311.  
  312.  
  313.